package com.vitogiovanni.tobook.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.vitogiovanni.tobook.entity.Utente;
import com.vitogiovanni.tobook.entity.UtenteEndpoint;

public class InserisciUtenteServlet extends HttpServlet {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * @see HttpServlet#HttpServlet()
	 */
	public InserisciUtenteServlet() {
		super();
	}
	/**
	 * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
	 */
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException 
	{
		
	}
	
	protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException 
	{
		Utente utente = new Utente(req.getParameter("email"));
		UtenteEndpoint utenteEndpoint = new UtenteEndpoint();
		
		utenteEndpoint.insertUtente(utente);
		
		resp.sendRedirect("/inserimento.html");

	}
	
	
}
